package com.ericsson.middleware.PermanentPooling;

import java.util.concurrent.atomic.AtomicInteger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class ParkingSpotsScheduledProcessor implements ParkingSpotsProcessor  {

    @Autowired
    private ParkingSpotsWorker worker;

    private final AtomicInteger counter = new AtomicInteger();
    
    // Scheduled pool
    @Scheduled(initialDelayString = "${parkingspotsinitialdelay}", fixedDelayString = "${parkingspotsfixeddelay}")
    public void process() {
        worker.work(counter.incrementAndGet());  
    } 
}
